package com.authine.cloudpivot.ext.enums.order;

import java.util.Arrays;
import java.util.List;

/**
 * 商品来源
 *
 * @author 张天赐
 */
public enum GoodsSrcEnum {

    /**
     * 商品源类型
     */
    SourcingSingle("单次寻源商品"),
    SourcingLoop("企业寻源商品"),
    Shop("商城商品"),
    Contract("代购商品"),
    Vmi("VMI商品"),
    EnterpriseMall("客户企业商城"),
    ExternalMall("外部商城"),
    Market("市场");
    public String des;


    GoodsSrcEnum(String des) {
        this.des = des;
    }

    public static List<GoodsSrcEnum> sourcing() {
        return Arrays.asList(GoodsSrcEnum.SourcingSingle, GoodsSrcEnum.SourcingLoop);
    }


    public static GoodsSrcEnum switchNew(Integer cartSrc) {
        switch (cartSrc) {
            case 1:
                return GoodsSrcEnum.Market;
            case 2:
                return GoodsSrcEnum.Shop;
            case 3:
                return GoodsSrcEnum.SourcingSingle;
            case 4:
                return GoodsSrcEnum.SourcingLoop;
            case 5:
                return GoodsSrcEnum.Contract;
            case 6:
                return GoodsSrcEnum.Vmi;
            case 7:
                return GoodsSrcEnum.EnterpriseMall;
            case 8:
                return GoodsSrcEnum.ExternalMall;
            default:
                return null;
        }
    }

    public static Integer switchOld(GoodsSrcEnum goodsSrcEnum) {
        switch (goodsSrcEnum) {
            case Market:
                return 1;
            case Shop:
                return 2;
            case SourcingSingle:
                return 3;
            case SourcingLoop:
                return 4;
            case Contract:
                return 5;
            case Vmi:
                return 6;
            case EnterpriseMall:
                return 7;
            case ExternalMall:
                return 8;
            default:
                return null;
        }
    }
}
